<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Laravel\Passport\HasApiTokens;
use Illuminate\Foundation\Auth\User as Authenticatable;

/**
 * Class ExhibitorInformation
 *
 * @property int $id
 * @property int $type_id
 * @property string|null $username
 * @property string|null $name
 * @property string|null $phone
 * @property string|null $password
 * @property string|null $address
 * @property string|null $remark
 * @property int $status
 * @property Carbon|null $created_at
 * @property Carbon|null $updated_at
 * @property string|null $cn_name
 * @property string|null $en_name_full
 * @property string|null $en_name
 * @property string|null $pwd
 * @property string|null $appellation
 * @property string|null $wx
 * @property string|null $telephone
 * @property string|null $e_mail
 * @property string|null $post_code
 * @property string|null $sales
 * @property int|null $customer_type
 * @property string|null $booth_number
 * @property int|null $booth_type
 * @property int|null $long
 * @property int|null $wide
 * @property int|null $area
 * @property string|null $discount
 * @property int|null $booth_fee
 * @property int|null $sponsorship_fees
 * @property int|null $signing_status
 * @property Carbon|null $signing_date
 * @property int|null $contract
 * @property int|null $unit_id
 * @property string|null $contacts
 * @property int|null $papers
 * @property string|null $files
 * @property int|null $collection_status
 * @property Carbon|null $collection_time
 * @property int|null $invoicing_status
 * @property Carbon|null $invoicing_time
 * @property int|null $is_invoicing
 *
 * @package App\Models
 */
class ExhibitorInformation extends Authenticatable
{
    use HasApiTokens;

    protected $table = 'exhibitor_information';

    protected $casts = [
        'type_id' => 'int',
        'status' => 'int',
        'customer_type' => 'int',
        'booth_type' => 'int',
        'long' => 'int',
        'wide' => 'int',
        'area' => 'int',
        'booth_fee' => 'int',
        'sponsorship_fees' => 'int',
        'signing_status' => 'int',
        'signing_date' => 'datetime',
        'contract' => 'int',
        'unit_id' => 'int',
        'papers' => 'int',
        'collection_status' => 'int',
        'collection_time' => 'datetime',
        'invoicing_status' => 'int',
        'invoicing_time' => 'datetime',
        'is_invoicing' => 'int',
        'invoice_upload_type_id' => 'int',
        'is_update_pwd' => 'int',
    ];

    protected $hidden = [
        'password'
    ];

    protected $fillable = [
        'type_id',
        'username',
        'name',
        'phone',
        'password',
        'address',
        'remark',
        'status',
        'cn_name',
        'en_name_full',
        'en_name',
        'pwd',
        'appellation',
        'wx',
        'telephone',
        'e_mail',
        'post_code',
        'sales',
        'customer_type',
        'booth_number',
        'booth_type',
        'long',
        'wide',
        'area',
        'discount',
        'booth_fee',
        'sponsorship_fees',
        'signing_status',
        'signing_date',
        'contract',
        'unit_id',
        'contacts',
        'papers',
        'files',
        'collection_status',
        'collection_time',
        'invoicing_status',
        'invoicing_time',
        'is_invoicing',
        'invoice_upload_type_id',
        'is_update_pwd',
    ];

    public function sales_personnelcompany()
    {
        return $this->belongsTo(SalesPersonnelCompany::class, 'sales', 'id');
    }

    public function journal_content()
    {
        return $this->belongsTo(JournalContent::class, 'id', 'exhibitor_information_id');
    }
}
